package com.soft.javase.day10.practice;

import java.util.function.Function;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/5/4
 */
public class FunctionCombine {
    public static void main(String[] args) {
        String str = "张三,20";

        Function<String, String> ageStr = s -> s.split(",")[1];

        Function<String, Integer> strToInt = Integer::parseInt;

        Function<Integer, Integer> add = num -> num + 100;

        Function<String, Integer> combine = ageStr.andThen(strToInt).andThen(add);

        int result = combine.apply(str);

        System.out.println("最终结果: " + result);
    }
}
